package Thread;


//懒汉法
class Singleton3{
    private static Singleton3 instance3=null;
    Object lock=new Object();
    public Singleton3 getInstance2(){
        if(instance3==null){
            synchronized (lock){
                if(instance3==null){
                    instance3=new Singleton3();
                }
            }
        }
        return instance3;
    }
    private Singleton3(){};

}
public class Demo19 {
    public static void main(String[] args) {

    }
}

